-
Notifications
You must be signed in to change notification settings - Fork 31
fix: Send identify event. #407
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix: Send identify event. #407
Conversation
|
This pull request has been linked to Shortcut Story #237713: Escalation: Multi contexts aren't appearing in context list.. |
| const changedKeys = calculateFlagChanges(this.flags, dataJson); | ||
| this.context = context; | ||
| this.flags = dataJson; | ||
| this.onIdentifyResolve(identifyResolve, dataJson, context, 'streamer PUT'); | ||
| await this.platform.storage?.set(canonicalKey, JSON.stringify(this.flags)); | ||
|
|
||
| if (changedKeys.length > 0) { | ||
| this.logger.debug(`Emitting changes from PUT: ${changedKeys}`); | ||
| // emitting change resolves identify | ||
| this.emitter.emit('change', context, changedKeys); | ||
| } else { | ||
| // manually resolve identify | ||
| this.logger.debug('Not emitting changes from PUT'); | ||
| identifyResolve(); | ||
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Dry'd this to onIdentifyResolve.
| } | ||
|
|
||
| const { identifyPromise, identifyResolve } = this.createPromiseWithListeners(); | ||
| this.eventProcessor?.sendEvent(this.eventFactoryDefault.identifyEvent(checkedContext)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This was the missing piece to send identify event.
| @@ -1,5 +1,4 @@ | |||
| import { ClientContext, internal, Platform } from '@launchdarkly/js-sdk-common'; | |||
| import { EventProcessor } from '@launchdarkly/js-sdk-common/dist/internal'; | |||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is an unrelated bug. I'm not sure why this wasn't caught by the linter.
|
|
||
| this.identifyChangeListener = (c: LDContext, changedKeys: string[]) => { | ||
| this.logger.debug(`change: context: ${JSON.stringify(c)}, flags: ${changedKeys}`); | ||
| resolve(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Resolve is now explicitly called when appropriate, rather than here. This is more sensible because not all 'change' events need to resolve the identify promise.
🤖 I have created a release *beep* *boop*
---
<details><summary>@launchdarkly/akamai-edgeworker-sdk-common:
1.1.2</summary>
### Dependencies
* The following workspace dependencies were updated
* dependencies
* @launchdarkly/js-server-sdk-common bumped from ^2.2.1 to ^2.2.2
</details>
<details><summary>@launchdarkly/akamai-server-base-sdk: 2.1.2</summary>
### Dependencies
* The following workspace dependencies were updated
* dependencies
* @launchdarkly/akamai-edgeworker-sdk-common bumped from ^1.1.1 to
^1.1.2
* @launchdarkly/js-server-sdk-common bumped from ^2.2.1 to ^2.2.2
</details>
<details><summary>@launchdarkly/akamai-server-edgekv-sdk:
1.1.2</summary>
### Dependencies
* The following workspace dependencies were updated
* dependencies
* @launchdarkly/akamai-edgeworker-sdk-common bumped from ^1.1.1 to
^1.1.2
* @launchdarkly/js-server-sdk-common bumped from ^2.2.1 to ^2.2.2
</details>
<details><summary>@launchdarkly/cloudflare-server-sdk: 2.4.2</summary>
### Dependencies
* The following workspace dependencies were updated
* devDependencies
* @launchdarkly/js-server-sdk-common-edge bumped from 2.2.1 to 2.2.2
</details>
<details><summary>js-client-sdk-common: 1.0.3</summary>
##
[1.0.3](js-client-sdk-common-v1.0.2...js-client-sdk-common-v1.0.3)
(2024-03-25)
### Bug Fixes
* Send identify event.
([#407](#407))
([1d73462](1d73462))
### Dependencies
* The following workspace dependencies were updated
* dependencies
* @launchdarkly/js-sdk-common bumped from 2.3.0 to 2.3.1
</details>
<details><summary>js-sdk-common: 2.3.1</summary>
##
[2.3.1](js-sdk-common-v2.3.0...js-sdk-common-v2.3.1)
(2024-03-25)
### Bug Fixes
* Send identify event.
([#407](#407))
([1d73462](1d73462))
</details>
<details><summary>@launchdarkly/js-server-sdk-common: 2.2.2</summary>
### Dependencies
* The following workspace dependencies were updated
* dependencies
* @launchdarkly/js-sdk-common bumped from 2.3.0 to 2.3.1
</details>
<details><summary>@launchdarkly/js-server-sdk-common-edge:
2.2.2</summary>
### Dependencies
* The following workspace dependencies were updated
* dependencies
* @launchdarkly/js-server-sdk-common bumped from 2.2.1 to 2.2.2
</details>
<details><summary>@launchdarkly/node-server-sdk: 9.2.2</summary>
### Dependencies
* The following workspace dependencies were updated
* dependencies
* @launchdarkly/js-server-sdk-common bumped from 2.2.1 to 2.2.2
</details>
<details><summary>@launchdarkly/node-server-sdk-dynamodb:
6.1.4</summary>
### Dependencies
* The following workspace dependencies were updated
* devDependencies
* @launchdarkly/node-server-sdk bumped from 9.2.1 to 9.2.2
</details>
<details><summary>@launchdarkly/node-server-sdk-redis: 4.1.4</summary>
### Dependencies
* The following workspace dependencies were updated
* devDependencies
* @launchdarkly/node-server-sdk bumped from 9.2.1 to 9.2.2
</details>
<details><summary>@launchdarkly/react-native-client-sdk:
10.0.4</summary>
### Dependencies
* The following workspace dependencies were updated
* dependencies
* @launchdarkly/js-client-sdk-common bumped from 1.0.2 to 1.0.3
</details>
<details><summary>@launchdarkly/vercel-server-sdk: 1.3.3</summary>
### Dependencies
* The following workspace dependencies were updated
* dependencies
* @launchdarkly/js-server-sdk-common-edge bumped from 2.2.1 to 2.2.2
</details>
---
This PR was generated with [Release
Please](https://github.com/googleapis/release-please). See
[documentation](https://github.com/googleapis/release-please#release-please).
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
No description provided.